<?php
session_start();
require('config.php');
require('lib/db_connect.php');
//Callbacks Jquery and JS
$script = array(
    "Jquery" => "jquery-1.10.2.min.js",
    "Slide Show" => "slideshow.js");
//Callbacks Header
require('themes/' .$front_end. '/header.php');
?>
        <div id="hot-box">
                <div id="hot-slide">
                    <div id="hot-slide-item">
                        <a href="#"><img src="images/item/1382305710_xperia-z1-hero-black-1240x840.jpg" /></a>
                        <img src="images/item/1382305760_asus-padfone-2-630.jpg" />
                        <img src="images/item/1382305911_microsoftsurface3.jpg" />
                        <img src="images/item/1382778336_louis_vuitton_evora_gm_n41132.jpg" />
                        <img src="images/item/1382305710_xperia-z1-hero-black-1240x840.jpg" />
                    </div>
                    <div id="hot-slide-nav">                        
                        <ul>
                            <li pos="1">&nbsp;</li>
                            <li pos="2">&nbsp;</li>
                            <li pos="3">&nbsp;</li>
                            <li pos="4">&nbsp;</li>
                            <div class="clear"></div>
                        </ul>
                    </div>
                </div>
                <div id="hot-contain">
                    <?php 
                        $query_hot = "SELECT * FROM item_hot as h, item as i WHERE h.item_id=i.item_id ORDER BY hot_id DESC LIMIT 0, 6";
                        $result_hot = mysql_query($query_hot, $con);
                        while ($row_hot = mysql_fetch_assoc($result_hot)) {
                            echo '<div class="hot-item"><a href="item.php?id=' .$row_hot['item_id']. '"><img src="images/item/' .$row_hot['item_img']. '" /></a><div class="hot-item-title">' .$row_hot['item_name']. '</div></div>';
                        }
                    ?>
                    
                </div>
        </div><!-- End Hot Box -->
        <div id="content">
                <div id="left-col">
                    <div class="module-new-item">
                        <h6 class="line-break"><span>Hàng mới về</span></h6>
                        <?php
                            $query = "SELECT * FROM item WHERE item_status<>4 ORDER BY item_id DESC LIMIT 0, 12";
                            $result = mysql_query($query, $con);
                            while ($row = mysql_fetch_assoc($result)) {
                                if ($row['item_status'] != 1) {
                                    switch($row['item_status']) {
                                        case 1: $status = '<strong style="color:green;">Đang bán</strong>';break;
                                        case 2: $status = '<strong style="color:orange;">Chưa có hàng</strong>';break;
                                        case 3: $status = '<strong style="color:blue;">Liên hệ</strong>';break;
                                    }
                                    echo '<div class="content-item"><a href="item.php?id=' .$row['item_id']. '"><img src="images/item/' .$row['item_img']. '" /></a><div class="content-title">' .$row['item_name']. '<br /><b style="color:#FA7414;">' .$status. '</b></div></div>';
                                } else {
                                    echo '<div class="content-item"><a href="item.php?id=' .$row['item_id']. '"><img src="images/item/' .$row['item_img']. '" /></a><div class="content-title">' .$row['item_name']. '<br /><b style="color:#FA7414;">' .number_format($row['item_price_sell']). ' VNĐ</b></div></div>';
                                }                                
                            }
                        ?>
                        <div class="clear"></div>
                    </div><!-- End Module -->
                    <div class="module-new-item">                        
                        <h6 class="line-break"><span>Xem nhiều nhất</span></h6> 
                        <?php
                            $query = "SELECT * FROM item WHERE item_status<>4 ORDER BY item_view DESC, item_id DESC LIMIT 0, 12";
                            $result = mysql_query($query, $con);
                            while ($row = mysql_fetch_assoc($result)) {
                                if ($row['item_status'] != 1) {
                                    switch($row['item_status']) {
                                        case 1: $status = '<strong style="color:green;">Đang bán</strong>';break;
                                        case 2: $status = '<strong style="color:orange;">Chưa có hàng</strong>';break;
                                        case 3: $status = '<strong style="color:blue;">Liên hệ</strong>';break;
                                    }
                                    echo '<div class="content-item"><a href="item.php?id=' .$row['item_id']. '"><img src="images/item/' .$row['item_img']. '" /></a><div class="content-title">' .$row['item_name']. '<br /><b style="color:#FA7414;">' .$status. '</b></div></div>';
                                } else {
                                    echo '<div class="content-item"><a href="item.php?id=' .$row['item_id']. '"><img src="images/item/' .$row['item_img']. '" /></a><div class="content-title">' .$row['item_name']. '<br /><b style="color:#FA7414;">' .number_format($row['item_price_sell']). ' VNĐ</b></div></div>';
                                }                                
                            }
                        ?>                       
                        <div class="clear"></div>
                    </div><!-- End Module -->
                    <div class="module-new-item">
                        <h6 class="line-break"><span>Hàng bán chạy nhất</span></h6>
                    </div><!-- End Module -->
                </div><!-- End Left Col -->
                <div id="right-col">
                    <div class="module-right">
                        <h6 class="module-title"><span>Tin Tức</span></h6>
                        <div class="module-news-item"></div>
                    </div>
                    <div class="module-right">
                        <h6 class="module-title"><span>Khuyến Mãi</span></h6>
                        <div class="module-news-item"></div>
                    </div>
                    <div class="module-right">
                        <h6 class="module-title"><span>Quảng cáo</span></h6>
                        <div class="module-news-item"></div>
                    </div>
                </div><!-- End Right Col -->
            <div class="clear"></div>                                  
        </div><!-- End Content -->     
<?php
//Callbacks Footer
require('themes/' .$front_end. '/footer.php');
?>                        